package com.byedu.model.constants;

/**
 * Created by jason on 2017/6/4.
 */
public enum CharsetType {
    GBK(0, "GBK"),
    UTF8(1, "UFT-8");

    private Integer key;
    private String value;

    private CharsetType(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getValue(Integer key) {
        for (CharsetType fileType : CharsetType.values()) {
            if (fileType.getKey() == key) {
                return fileType.getValue();
            }
        }

        return null;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.key + "_" + this.value;
    }

}
